/*
 * Copyright (c) 2006, 2021, webrx.cn All rights reserved.
 *
 */
package cn.webrx;

/**
 * <p>Project: javase - Forin
 * <p>Powered by webrx On 2021-11-25 14:21:44
 *
 * @author webrx [webrx@126.com]
 * @version 1.0
 * @since 17
 */
public class Forin {
    public static void main(String[] args) {
        String str = "hello中国人";


        //for : 相当于 javascript for of 相当于 php foreach
        for (char c : str.toCharArray()) {
            System.out.println(c);
        }

        for (int i = str.toCharArray().length - 1; i >= 0; i--) {
            System.out.println(str.toCharArray()[i]);
        }

        var ns = new int[]{10, 20, 30, 40, 50};
        for (var i : ns) {
            //System.out.println(i);
        }

        for (String v : System.getenv().values()) {
            //System.out.println(v);
        }

        //lambda java 8 新的增函数式编程技术 .forEach(lambda表达式，表达语句中不能使用break continue)
        //System.getProperties().values().forEach(System.out::println);
        for (var v : System.getProperties().values()) {
            //System.out.println(v);
        }
    }
}
